package com.common.domain.dto;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @author liuxuhuang
 * @date 2023年04月21日 11:03
 * @desc 获取维修记录查询条件
 */
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode
@ToString
public class MaintainQueryDTO implements Serializable {
    /**
     * 宿舍id
     */
    private String dormId;
    /**
     * 内容 描述
     */
    private String context;
    /**
     * 楼宇id
     */
    private String buildId;

    /**
     * 时间范围
     */
    private List<String> dateRange;

    /**
     * 第几页
     */
    private Integer pageNum;
    /**
     * 每页几条数据
     */
    private Integer pageSize;

    public String getDormId() {
        return dormId;
    }

    public void setDormId(String dormId) {
        this.dormId = dormId;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getBuildId() {
        return buildId;
    }

    public void setBuildId(String buildId) {
        this.buildId = buildId;
    }

    public List<String> getDateRange() {
        return dateRange;
    }

    public void setDateRange(List<String> dateRange) {
        this.dateRange = dateRange;
    }

    public Integer getPageNum() {
        if (pageNum <= 0 || Objects.isNull(pageNum)) {
            return 1;
        }
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        if (pageSize <= 0 || Objects.isNull(pageSize)) {
            return 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
